package org.hcf.utils.excel.poi.base.exp.header;

import lombok.Getter;
import lombok.Setter;
import org.apache.poi.ss.usermodel.Cell;
import org.hcf.utils.excel.poi.base.exp.SimpleExcelHelper;

import java.util.Collection;
import java.util.function.Supplier;

@Getter@Setter
public abstract class TableHeader<T> {
    /** 列名 */
    private String fieldName;
    /** 宽度 */
    private int width;

    public TableHeader(String fieldName, int width) {
        this.fieldName = fieldName;
        this.width = width;
    }

    /** 默认设置 defaultHeadCellStyle */
    public void initHeadCellStyle(Cell headerCell, SimpleExcelHelper excelHelper){
        headerCell.setCellStyle(excelHelper.getDefaultHeadCellStyle());
    }

    /** 默认设置 defaultDataCellStyle */
    public void initDataCellStyle(Cell dataCell,SimpleExcelHelper excelHelper){
        dataCell.setCellStyle(excelHelper.getDefaultDataCellStyle());
    }
    /** 请调用 cell中具体的 */
    public abstract void dataCellout(Cell cell, T t);

    public void setDataValidation(String validationDataSheetName, Boolean sheetHiden, Supplier<Collection<String>> validationDatasFunc){
        Collection<String> validationDatas = validationDatasFunc.get();
        setDataValidation(validationDataSheetName, sheetHiden, validationDatas);
    }

    public void setDataValidation(String validationDataSheetName, Boolean sheetHiden, Collection<String> validationDatas){

    }
}
